package test.springAop;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;

/**
 * @author fanhb on 2017/8/19
 * @desc xxxx
 */
public class DateUtils {

    public static Date getRundomDate(Object obj) {
        Random r = new Random();
        Calendar instance = Calendar.getInstance();
        instance.set(Calendar.YEAR,2000);
        instance.set(Calendar.MONTH,Calendar.FEBRUARY);
        instance.set(Calendar.DAY_OF_MONTH,r.nextInt(30));

        return instance.getTime();

    }

    public static String getDateString(Date date) {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format = sdf.format(date);
        return format;

    }
}
